package com.shujia.wyh.day12.ketang;


class Animal4 {
    public void show() {
        System.out.println("这是父类中show()方法");
    }
}

class Dog4 extends Animal4 {
    public void show() {
        System.out.println("这是Dog4类中的show()方法");
    }
}

class Cat4 extends Animal4 {
    public void show() {
        System.out.println("这是Cat4类中的show()方法");
    }
}

public class DuoTaiDemo5 {
    public static void main(String[] args) {
        Animal4 a = new Dog4();
        Cat4 c = (Cat4) a; //ClassCastException



//        Animal4 p0 = new Animal4();
//        Dog4 p1 = new Dog4 ();
//        Cat4 p2 = new Cat4 ();
//        Animal4 p3 = new Dog4 ();
//        Animal4 p4 = new Cat4 ();
//
//        p0 = p1;
//        p1 = p2;
//        p1 = (Dog4)p3;
//        p2 = (Cat4)p4;


    }
}
